package com.power.ding.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import com.power.ding.model.Di_message;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 钉钉消息发送 持久层(hibernate)
 */

public interface Di_messageDao extends JpaRepository<Di_message, Serializable>, JpaSpecificationExecutor<Di_message>, Repository<Di_message, Serializable>, Di_messageDaoCustom<Di_message, Serializable> {

   @Modifying
   @Transactional
   @Query("delete  from Di_message s where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<Integer> ids);

   @Query("select id from Di_message s where s.sendTime is null and sendError is not null order by id")
   List<String> findUnsendList();
}
